package com.kuang.swagger.controller;

import com.kuang.swagger.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

@Api(tags = "Hello控制类")
@RestController
public class HelloController {

    //error  默认请求
    @GetMapping("/kuang/hello")
    public String hello(){
        return "hello";
    }

    //只要我们的接口中返回值存在实体类，他就会被扫描到swagger中
    @PostMapping("/kuang/user")
    public User user(){
        return new User();
    }

    //Operation接口,不是放在类上的是方法
    @ApiOperation("Hello控制类")
    @PostMapping("/kuang/hello2")
    public String hello2(@ApiParam("用户名") String user_name){
        return user_name;
    }


    @ApiOperation("Post测试")
    @PostMapping("/kuang/postt")
    @ResponseBody
    public User postt(User user){
        return user;
    }
}
